define([
    "UtilDir/util",
    "UtilDir/tool",
    "UtilDir/org/selectOrg",
    "UtilDir/searchBlock",
    "static/app/hddc/hddccjcommon/hddccjCommon",
    "Date","DateCN", "css!DateCss",
    "EasyUI","EasyUI-lang"
],function(Util, Tool, SelectOrg, SearchBlock,HddccjCommon){
    //B1_GeologicalSurveyMapping（地质调查）
    //获取线路|面经纬度数组
    var getLonLatArray = function(LonLatString){
        var LonLatArray = [];//经纬度数组
        var strArray = LonLatString.split(";");
        if(strArray!=null && strArray.length>0){
            for(var i=0;i<strArray.length;i++){
                var str = strArray[i];
                var lonlatStrArray = str.split(",");
                if(lonlatStrArray!=null && lonlatStrArray.length==2){
                    var lonStr = lonlatStrArray[0];
                    var latStr = lonlatStrArray[1];
                    if(lonStr!="" && latStr!=""){
                        var lon = parseFloat(lonStr);
                        var lat = parseFloat(latStr);
                        if(lon>0 && lon<180 && lat>0 && lat<90){
                            //经纬度
                            var lonlat = [lon,lat];
                            //添加经纬度
                            LonLatArray.push(lonlat);
                        }
                    }
                }
            }
        }
        return LonLatArray;
    };

    //26-活动断层-线
    var getHddcActivefaultController = function(){
        return getServer() + "/hddc/hddcActivefaults";
    };
    var initQueryActiveFaultData = function () {
        console.log("26-活动断层-线");
        var allLonLatArray = [];
        var allUuidArray = [];
        var allDataArray=[];
        $.ajax({
            url: getHddcActivefaultController() + "/queryAllSpaceData/",
            type: "get",
            async:true,
            success: function (data) {
                for(var i=0;i<data.length;i++){
                    var LonLatString = data[i].extends5;//经纬度字符串
                    if(LonLatString!=null && LonLatString!=""){
                        var LonLatArray = getLonLatArray(LonLatString);//获取经纬度数组
                        //添加经纬度数组
                        allLonLatArray.push(LonLatArray);
                        //添加UUID
                        allUuidArray.push(data[i].uuid);
                    }
                }
                allDataArray = [allUuidArray,allLonLatArray];
            }
        });
        return allDataArray;
    };

    //27-地质调查路线-线
    var getHddcGeologicalsvylineController = function(){
        return getServer() + "/hddc/hddcGeologicalsvylines";
    };
    var initQueryGeologicalSvyLineData = function () {
        console.log("27-地质调查路线-线");
        var allLonLatArray = [];
        var allUuidArray = [];
        var allDataArray=[];
        $.ajax({
            url: getHddcGeologicalsvylineController() + "/queryAllSpaceData/",
            type: "get",
            async:true,
            success: function (data) {
                for(var i=0;i<data.length;i++){
                    var LonLatString = data[i].extends5;//经纬度字符串
                    if(LonLatString!=null && LonLatString!=""){
                        var LonLatArray = getLonLatArray(LonLatString);//获取经纬度数组
                        //添加经纬度数组
                        allLonLatArray.push(LonLatArray);
                        //添加UUID
                        allUuidArray.push(data[i].uuid);
                    }
                }
                allDataArray = [allUuidArray,allLonLatArray];
            }
        });
        return allDataArray;
    };

    //28-地貌线-线
    var getHddcGeomorphylineController = function(){
        return getServer() + "/hddc/hddcGeomorphylines";
    };
    var initQueryGeomorphyLineData = function () {
        console.log("28-地貌线-线");
        var allLonLatArray = [];
        var allUuidArray = [];
        var allDataArray=[];
        $.ajax({
            url: getHddcGeomorphylineController() + "/queryAllSpaceData/",
            type: "get",
            async:true,
            success: function (data) {
                for(var i=0;i<data.length;i++){
                    var LonLatString = data[i].extends5;//经纬度字符串
                    if(LonLatString!=null && LonLatString!=""){
                        var LonLatArray = getLonLatArray(LonLatString);//获取经纬度数组
                        //添加经纬度数组
                        allLonLatArray.push(LonLatArray);
                        //添加UUID
                        allUuidArray.push(data[i].uuid);
                    }
                }
                allDataArray = [allUuidArray,allLonLatArray];
            }
        });
        return allDataArray;
    };

    //29-地貌面-面
    var getHddcGeomorphypolygonController = function(){
        return getServer() + "/hddc/hddcGeomorphypolygons";
    };
    var initQueryGeomorphyPolygonData = function () {
        console.log("29-地貌面-面");
        var allLonLatArray = [];
        var allUuidArray = [];
        var allDataArray=[];
        $.ajax({
            url: getHddcGeomorphypolygonController() + "/queryAllSpaceData/",
            type: "get",
            async:true,
            success: function (data) {
                for(var i=0;i<data.length;i++){
                    var LonLatString = data[i].extends5;//经纬度字符串
                    if(LonLatString!=null && LonLatString!=""){
                        var LonLatArray = getLonLatArray(LonLatString);//获取经纬度数组
                        //添加经纬度数组
                        allLonLatArray.push(LonLatArray);
                        //添加UUID
                        allUuidArray.push(data[i].uuid);
                    }
                }
                allDataArray = [allUuidArray,allLonLatArray];
            }
        });
        return allDataArray;
    };

    //30-地质剖面线-线
    var getHddcGeoprofilelineController = function(){
        return getServer() + "/hddc/hddcGeoprofilelines";
    };
    var initQueryGeoProfileLineData = function () {
        console.log("30-地质剖面线-线");
        var allLonLatArray = [];
        var allUuidArray = [];
        var allDataArray=[];
        $.ajax({
            url: getHddcGeoprofilelineController() + "/queryAllSpaceData/",
            type: "get",
            async:true,
            success: function (data) {
                for(var i=0;i<data.length;i++){
                    var LonLatString = data[i].extends5;//经纬度字符串
                    if(LonLatString!=null && LonLatString!=""){
                        var LonLatArray = getLonLatArray(LonLatString);//获取经纬度数组
                        //添加经纬度数组
                        allLonLatArray.push(LonLatArray);
                        //添加UUID
                        allUuidArray.push(data[i].uuid);
                    }
                }
                allDataArray = [allUuidArray,allLonLatArray];
            }
        });
        return allDataArray;
    };

    return {
        initQueryActiveFaultData:initQueryActiveFaultData,
        initQueryGeologicalSvyLineData:initQueryGeologicalSvyLineData,
        initQueryGeomorphyLineData:initQueryGeomorphyLineData,
        initQueryGeomorphyPolygonData:initQueryGeomorphyPolygonData,
        initQueryGeoProfileLineData:initQueryGeoProfileLineData
    };
});
